package JDBCUI;

import SwingWork.Family;
import SwingWork.Information;
import SwingWork.School;
import edu.jiemian;
import family.mainFamily;
import staff.mainSchool;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class MainJFrame extends JFrame {


    public MainJFrame() {
        // 可以发现按钮和文本框都已经有了变化，给窗口润色不少。
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        }catch(Exception e) {

            System.out.println(e);

        }



        //创建顶层容器

        JFrame jframe = new JFrame("教师管理系统");

        Dimension d = new Dimension(500,400);
        Point p = new Point (250,350);
        //设置大小
        jframe.setSize(d);

        jframe.setLocation(p);
        jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //窗口放大
        //jframe.setResizable(false);


        //创建按钮组件
        JButton button1 = new JButton("教师的家庭关系管理子系统");
        JButton button2 = new JButton("学校部门信息、职务、职称和教职工信息管理子系统");
        JButton button3 = new JButton("教师的学籍经历管理子系统");
        JButton button4 = new JButton("教师的奖惩信息管理子系统");

       /* ImageIcon icon = new ImageIcon("D:/IDEA.flle/JDBC/Test/src/edu/image.jpg");
        JLabel label =  new JLabel(icon );
        label.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());*/
        //流布局 左对齐，间距

        FlowLayout flow = new FlowLayout(FlowLayout.LEFT,50,50);

        //创建中间容器
        JPanel panel = new JPanel(new GridLayout(2,5));
        //将负责放置控件的面板设置成透明
        // panel.setOpaque(false);


        //设置大小
        panel.setSize(300,400);
        //设置背景颜色
        panel.setBackground(Color.LIGHT_GRAY);
        panel.add(button1);
        panel.add(button2);
        panel.add(button3);
        panel.add(button4);



        //将中间容器放在窗口中
        jframe.getContentPane().add(panel);


        //家庭关系
        button1.addActionListener(new ActionListener(){

            public void actionPerformed(ActionEvent e){
                mainFamily family =  new mainFamily();
            }
        });

        //信息管理
        button2.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
                mainSchool  allinfo =new mainSchool();
            }
        });
        //学籍经历管理
        button3.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
                jiemian school =new jiemian();
            }
        });

         //奖惩   管理
        button4.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){

                Rewardmanage rewardmanage = new Rewardmanage();
               /* Staff staff =new Staff();
                Huode huode = new Huode();*/
            }
        });


        //显示窗口

        jframe.setVisible(true);
    }

    /*public static void main(String[] args) {

        new MainJFrame();
    }*/
    }










